<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css" />
<title>用户登录_约导游</title>
<!--css-->
</head>

<body>
<!--head begin-->
	<%@ include  file="./common/header.jsp"%>
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou">
    <dt><span>您的位置：<a href="index.jsp">约导游</a> &gt; <a href="login.jsp">登录</a></span>用户登录</dt>
    <dd>
      <div class="login">
        <div class="login_dl">
          <h3><span><a href="join.jsp">么有账号？立即注册&gt;&gt;</a></span>会员登录</h3>
          <form class="login_input" id="login_input_id" >
            <ul>
              <li><span>账户：</span>
                <input type="text" name="userName" id="d_userNameId" value="" placeholder="请准确填写用户名称">
              </li>
              <li><span>密码：</span>
                <input type="password" name="password" id="d_passwordId" value="" placeholder="请准确填写登陆密码" onkeydown=loginKeyDown()>
              </li>
              <li><span>　　　</span>
                <button type="button" value="登 录" onclick="login()">登录</button>
              </li>
            </ul>
            </form>
         <!--  <div class="login_other">
          <p>通过其他账号登陆本站</p>
          </div> -->
        </div>
      </div>
    </dd>
  </dl>
</div>
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end-->
</body>
<script type="text/javascript">
function loginKeyDown() {
	if(event.keyCode == 13){
		login();
	}
}
function loginValidate(tipText,tipText1)  
{  
    return $('#login_input_id').validate({  
        rules:{  
        	userName:'required', 
        	password:'required'
        	
            },  
        messages:{  
        	userName:'&nbsp;&nbsp;'+tipText+'',
        	password:'&nbsp;&nbsp;'+tipText1+''
        	
            },  
    });  
}  
function login() {
	if(loginValidate("*","*").form()) {
	}else{
		return;
	}
	var userName = $("#d_userNameId").val();
	var password = $("#d_passwordId").val();
	//objp= {}
	//objp.name = name;
	//objp.userName = userName;
	//var objp= "{\"name\":"+name+",\"userName\":"+userName+"}";
	var objp= "{\"userName\":\""+userName+"\","+
		         "\"password\":\""+password+"\""+
		        // "\"userName\":"+userName+","+
		         //"\"userName\":"+userName+","+
		        // "\"confirm_pass\":"+confirm_pass+""+
		         "}";
	   $.ajax({
			  url: '${path}/core/login',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
		      dataType:"json",      
	          contentType:"application/json",   
		     // contentType: "application/json; charset=utf-8",
			  success:function(msg){
				  if(msg.userType==0){
					  window.location.href='${path}/lxslogin.jsp';
				  }else if(msg.userType==1) {
					  window.location.href='${path}/lxslogin.jsp';
				  }else if(msg.userType==2){
					  window.location.href='${path}/dylogin_5.jsp'; 
				  };
				  if(msg.userType==-1){
					  window.location.href='${path}/adminlogin.jsp';
				  }
			  },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
</html>
